protected virtual void AddNode(rMindBaseNode node) { if (string.IsNullOrEmpty(node.IDS)) { node.IDS = "node" + m_nodes_link.Count.ToString(); } m_nodes_link[node.IDS] = node; Template.Children.Add(node.Template); }
public virtual rMindBaseNode CreateNode(rMindNodeDesc desc) { var node = new rMindBaseNode(this) { ConnectionType = desc.ConnectionType }; node.IDS = "node" + m_nodes_link.Count.ToString(); m_nodes_link[node.IDS] = node; Template.Children.Add(node.Template); return(node); }
public void RemoveNode(rMindBaseNode node) { if (NodesA.Contains(node)) { RemoveANode(node); return; } if (NodesB.Contains(node)) { RemoveBNode(node); } }
// Bske nodes for magnet public void BakeNodes(rMindBaseNode root) { BakedNodes.Clear(); // Собираем все ноды var nodes = m_items .SelectMany(x => x.Nodes) .Where(node => node.CanAttach && node.Parent != root.Parent) .Where(node => node.ConnectionType == root.ConnectionType) .Where(node => node.NodeType != root.NodeType) .Select(node => new KeyValuePair <Vector2, rMindBaseNode>(node.GetOffset(), node)); BakedNodes.AddRange(nodes); }
protected override void RemoveANode(rMindBaseNode node) { var outMax = m_parent.VLines.Where(x => x != this).Max(x => x.TopNodes.Count); if (TopNodes.Count > outMax) { /* Если количество занимаемых колонок больше, чем у остальных строк * Нужно удалять колонку грида и сдвинуть все узлы. Кроме своих. */ var nodes = m_parent.VLines.Where(x => x != this).Select(x => x as rMindLine) .Union(m_parent.HLines.Select(x => x as rMindLine)) .Select(x => x.NodesA.Union(x.NodesB)); foreach (var arr in nodes) { foreach (var n in arr) { n.Row--; } } // Среди своих узлов удаляем только те, что правее var offsetNodes = TopNodes.Union(BottomNodes).Where(x => x.Row > node.Row); foreach (var n in offsetNodes) { n.Row--; } if (m_parent.Template.RowDefinitions.Count > 1) { m_parent.Template.RowDefinitions.Remove( m_parent.Template.RowDefinitions.Last() ); } } else { var offsetNodes = TopNodes.Where(x => x.Row < node.Row); foreach (var n in offsetNodes) { n.Row++; } } TopNodes.Remove(node); m_parent.UpdateBase(); m_parent.RemoveNode(node); }
public void RemoveNode(rMindBaseNode node) { if (node == null) { return; } if (m_nodes_link.ContainsKey(node.IDS)) { node.Detach(); m_nodes_link.Remove(node.IDS); UpdateNodes(); Template.Children.Remove(node.Template); } }
// Bske nodes for magnet public void BakeNodes(rMindBaseNode root) { BakedNodes.Clear(); foreach (var list in m_items.Select(x => x.Nodes)) { BakedNodes.AddRange( list .Where(node => node.CanAttach && node.Parent != root.Parent) .Select(node => new KeyValuePair <Vector2, rMindBaseNode>(node.GetOffset(), node ) ) ); } }
public void Detach() { m_area.RadiusX = 3; m_area.RadiusY = 3; if (Node != null) { var node = Node; m_node = null; node?.Detach(this); if (GetController()?.CheckIsDraggedDot(this) == false) { Wire.Delete(); } } }
public rMindBaseWireDot SetNode(rMindBaseNode node) { m_node = node; if (node != null) { var r = node.ConnectionType == rMindNodeConnectionType.Container ? 6 : 0; m_area.RadiusX = r; m_area.RadiusY = r; Wire.Update(); } else { m_area.RadiusX = 3; m_area.RadiusY = 3; } return(this); }
public rMindBaseWireDot SetNode(rMindBaseNode node) { m_node = node; if (node != null) { var r = node.ConnectionType == rMindNodeConnectionType.Container ? 6 : 0; m_area.Fill = node.Theme.BaseStroke; m_area.RadiusX = r; m_area.RadiusY = r; Wire.SetWireColor(); Wire.Update(); } else { m_area.RadiusX = 3; m_area.RadiusY = 3; m_area.Fill = m_area_fill; } return(this); }
protected override void RemoveBNode(rMindBaseNode node) { var outMax = m_parent.VLines.Where(x => x != this).Max(x => x.BottomNodes.Count); if (BottomNodes.Count > outMax) { if (m_parent.Template.RowDefinitions.Count > 1) { m_parent.Template.RowDefinitions.Remove( m_parent.Template.RowDefinitions.Last() ); } } var offsetNodes = BottomNodes.Where(x => x.Row > node.Row); foreach (var n in offsetNodes) { n.Row--; } BottomNodes.Remove(node); m_parent.RemoveNode(node); }
protected override void RemoveBNode(rMindBaseNode node) { var outMax = m_parent.HLines.Where(x => x != this).Max(x => x.RightNodes.Count); if (RightNodes.Count > outMax) { if (m_parent.Template.ColumnDefinitions.Count > 1) { m_parent.Template.ColumnDefinitions.Remove( m_parent.Template.ColumnDefinitions.Last() ); } } var offsetNodes = RightNodes.Where(x => x.Column > node.Column); foreach (var n in offsetNodes) { n.Column--; } RightNodes.Remove(node); m_parent.RemoveNode(node); }
protected virtual void RemoveBNode(rMindBaseNode node) { }
public void SetOveredNode(rMindBaseNode node) { m_items_state.OveredNode = node; }