public void ZoomOut() { this.AssertValid(); this.VerifyIsZoomable("ZoomOut"); if (!this.CanZoomOut()) { throw new InvalidOperationException("TreemapControl.ZoomOut: Can't zoom out. Check the CanZoomOut property first."); } Nodes nodes = this.Nodes; Debug.Assert(nodes.Count == 1); Node node = nodes[0]; Node[] array = null; float sizeMetric = -3.40282347E+38f; ZoomAction oState = null; Debug.Assert(this.m_oZoomActionHistoryList.HasCurrentState); ZoomAction peekCurrentState = this.m_oZoomActionHistoryList.PeekCurrentState; if (peekCurrentState.ParentOfZoomedNode == null) { array = this.m_oZoomActionHistoryList.OriginalTopLevelNodes; sizeMetric = this.m_oZoomActionHistoryList.OriginalTopLevelEmptySpaceSizeMetric; oState = new ZoomedFromOneTopLevelNodeAction(this.m_oZoomActionHistoryList, null, node); } else { Node parentOfZoomedNode = peekCurrentState.ParentOfZoomedNode; array = new Node[] { parentOfZoomedNode }; sizeMetric = 0f; Debug.Assert(parentOfZoomedNode != null); node.PrivateSetParent(parentOfZoomedNode); oState = new ZoomedFromInnerNodeAction(this.m_oZoomActionHistoryList, parentOfZoomedNode, node); } this.m_oZoomActionHistoryList.InsertState(oState); Node selectedNode = this.SelectedNode; this.m_oTreemapGenerator.Clear(); this.BeginUpdate(); Node[] array2 = array; for (int i = 0; i < array2.Length; i++) { Node node2 = array2[i]; nodes.Add(node2); } nodes.EmptySpace.SizeMetric = sizeMetric; this.EndUpdate(); if (selectedNode != null) { this.FireSelectedNodeChanged(); } }
public void ZoomIn(Node node) { Debug.Assert(node != null); this.AssertValid(); this.VerifyIsZoomable("ZoomIn"); if (!this.CanZoomIn(node)) { throw new InvalidOperationException("TreemapControl.ZoomIn: Can't zoom in to node. Check the CanZoomIn property first."); } Nodes nodes = this.Nodes; Debug.Assert(nodes.Count > 0); ZoomAction oState = null; if (nodes.Count > 1 || !this.m_oZoomActionHistoryList.HasCurrentState) { oState = new ZoomedFromTopLevelAction(this.m_oZoomActionHistoryList, node, nodes); } else { Debug.Assert(nodes.Count == 1); Debug.Assert(this.m_oZoomActionHistoryList.HasCurrentState); Node node2 = nodes[0]; ZoomAction peekCurrentState = this.m_oZoomActionHistoryList.PeekCurrentState; if (peekCurrentState.ParentOfZoomedNode == null) { if (this.m_oZoomActionHistoryList.OriginalTopLevelNodes.Length > 1) { oState = new ZoomedFromOneTopLevelNodeAction(this.m_oZoomActionHistoryList, node, node2); } else { oState = new ZoomedFromTopLevelAction(this.m_oZoomActionHistoryList, node, nodes); } } else { Debug.Assert(peekCurrentState.ParentOfZoomedNode != null); node2.PrivateSetParent(peekCurrentState.ParentOfZoomedNode); oState = new ZoomedFromInnerNodeAction(this.m_oZoomActionHistoryList, node, node2); } } this.m_oZoomActionHistoryList.InsertState(oState); Node selectedNode = this.SelectedNode; this.m_oTreemapGenerator.Clear(); nodes.Add(node); if (selectedNode != null) { this.FireSelectedNodeChanged(); } }