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(); } }
protected virtual void OnZoom(float zoomInput) { // Copy event to avoid race scenarios ZoomAction handler = Zoomed; if (handler != null) { handler(zoomInput); } }
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(); } }
public PlotControl() { // InitializeComponent(); DoubleBuffered = true; Model = new PlotModel(); panAction = new PanAction(this); zoomAction = new ZoomAction(this); sliderAction = new SliderAction(this); MouseActions = new List<MouseAction>(); MouseActions.Add(panAction); MouseActions.Add(zoomAction); MouseActions.Add(sliderAction); }
public PlotControl() { // InitializeComponent(); DoubleBuffered = true; Model = new PlotModel(); panAction = new PanAction(this); zoomAction = new ZoomAction(this); sliderAction = new SliderAction(this); MouseActions = new List <MouseAction>(); MouseActions.Add(panAction); MouseActions.Add(zoomAction); MouseActions.Add(sliderAction); }
public bool CanZoomOut() { this.AssertValid(); this.VerifyIsZoomable("CanZoomOut"); bool result; if (!this.m_oZoomActionHistoryList.HasCurrentState) { result = false; } else { ZoomAction peekCurrentState = this.m_oZoomActionHistoryList.PeekCurrentState; result = peekCurrentState.CanZoomOutFromZoomedNode(); } return(result); }
public void MoveForward() { this.AssertValid(); this.VerifyIsZoomable("MoveForward"); if (!this.CanMoveForward()) { throw new InvalidOperationException("TreemapControl.MoveForward: Can't move forward. Check the CanMoveForward property first."); } Debug.Assert(this.m_oZoomActionHistoryList.HasNextState); ZoomAction zoomAction = (ZoomAction)this.m_oZoomActionHistoryList.NextState; Node selectedNode = this.SelectedNode; zoomAction.Redo(this.m_oTreemapGenerator); if (selectedNode != null) { this.FireSelectedNodeChanged(); } }
public void MoveBack() { this.AssertValid(); this.VerifyIsZoomable("MoveBack"); if (!this.CanMoveBack()) { throw new InvalidOperationException("TreemapControl.MoveBack: Can't move back. Check the CanMoveBack property first."); } Debug.Assert(this.m_oZoomActionHistoryList.HasCurrentState); ZoomAction currentState = this.m_oZoomActionHistoryList.CurrentState; Node selectedNode = this.SelectedNode; currentState.Undo(this.m_oTreemapGenerator); if (selectedNode != null) { this.FireSelectedNodeChanged(); } }
public virtual void Compose(Display <TData> display) { display.HitSize = 6; display.GripSize = 4; this.Clipper = () => display.Clipper; this.Viewport = () => display.Viewport; this.Camera = () => display.Viewport.Camera; this.Renderer = () => display.BackendRenderer; this.DeviceCursor = () => display.CursorHandler; display.ClipReceiver.Clipper = display.Clipper; display.ClipReceiver.Renderer = this.Renderer; display.ClipReceiver.Viewport = this.Viewport; display.DataLayer.Data = () => display.Data; display.DataLayer.Camera = this.Camera; display.DataLayer.Renderer = () => display.DataRenderer; display.Viewport.GetDataOrigin = this.DataOrigin; display.Viewport.GetDataSize = this.DataSize; display.ActionDispatcher.Add(display.DataLayer); display.ActionDispatcher.Add(display.ClipReceiver); var zoomAction = new ZoomAction(); zoomAction.Viewport = this.Viewport; display.ActionDispatcher.Add(zoomAction); var scroll = new MouseScrollAction(); scroll.Viewport = this.Viewport; scroll.Enabled = false; display.MouseScrollAction = scroll; display.ActionDispatcher.Add(scroll); }